function [IRF] = IRFVAR(A,A0inv,p,h)
% This file calculate impulse responses.

q               =   size(A0inv,1);
J               =   [eye(q,q) zeros(q,q*(p-1))];
IRF             =   reshape(J*A^0*J'*A0inv,q^2,1);

for ix = 1:h
    IRF             =   ([IRF reshape(J*A^ix*J'*A0inv,q^2,1)]);
end
